#ifndef _BSP_TM1650_H
#define _BSP_TM1650_H
#include "driver/gpio.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/queue.h"
#include "driver/i2c.h"


#define     I2C_MASTER_SDA_PORT     GPIO_NUM_3
#define     I2C_MASTER_SCL_PORT     GPIO_NUM_4

#define I2C_MASTER_NUM I2C_NUM_0   /*!< I2C port number for master dev */

#define LED_DIG1_ADD  0X68
#define LED_DIG2_ADD  0X6A  
#define LED_DIG3_ADD  0X6C
#define LED_DIG4_ADD  0X6E



#define KEY_NO_BUTTON_PRESS  0X2E

#define KEY_DIG1_SW1_PRESS  0X44       
#define KEY_DIG1_SW2_PRESS  0X64        
#define KEY_DIG1_SW3_PRESS  0X4C           
#define KEY_DIG1_SW4_PRESS  0X5C          


union grid3_t{
    uint8_t grid3_byte;
    struct {
        uint8_t grid3_power5:1;
        uint8_t grid3_power6:1;
        uint8_t grid3_power7:1;
        uint8_t grid3_power8:1;
        uint8_t grid3_high:1;
        uint8_t grid3_low:1;
        uint8_t grid3_point:1;
        uint8_t grid3_reserve:1;
    }grid3_bit_t;
};


union grid4_t{
    uint8_t grid4_byte;
    struct {
        uint8_t grid4_power4:1;
        uint8_t grid4_power3:1;
        uint8_t grid4_power2:1;
        uint8_t grid4_power1:1;
        uint8_t grid4_high:1;
        uint8_t grid4_low:1;
        uint8_t grid4_wifi:1;
        uint8_t grid4_ble:1;
    }grid4_bit_t;
};




extern QueueHandle_t display_led_queue;


void tm1650_init(void);
uint8_t *TM1650_led_datatrans(uint8_t data_status, uint16_t data_runtime_left, uint8_t mode,
    uint8_t strength,uint8_t ifble,uint8_t ifwifi,uint8_t index_flash_status);
uint8_t tm1650_key_scan(void);

#endif // ! _BSP_DISPLAY_H






